import request from '@/utils/request'

/**
 * 用户服务
 * @type {{activeUser: (function(*): *), listAddress: (function(*): *), editUser: (function(*=): *), deleteUser: (function(*): *), listUser: (function(*): *)}}
 */
export const UserService = {
  // 会员列表
  listUser: function(query) { return request({ method: 'get', url: '/manage/user/list.do', params: { ...query }}) },
  // 激活冻结会员
  activeUser: function(data) { return request({ method: 'get', url: '/manage/user/active.do', params: { userId: data.id, enable: data.enable }}) },
  // 编辑会员
  editUser: function(data) { return request({ method: 'post', url: '/manage/user/edit.do', data: data }) },
  // 删除会员
  deleteUser: function(id) { return request({ method: 'post', url: '/manage/user/delete.do', data: [id] }) },
  // 会员收货地址列表
  listAddress: function(query) { return request({ method: 'get', url: '/manage/address/list.do', params: { ...query }}) },
  // 同步公众号用户信息
  syncMpUser: function(appId) { return request({ method: 'get', url: '/manage/user/mp/sync.do', params: { appId: appId }}) }
}
